// @see https://www.electron.build/configuration/configuration
import * as os from "node:os";

export default function() {
  const platform = process.platform;
  const arch = os.arch();
  return {
    $schema:
      "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
    appId: "com.faBbx.app",
    // 是否将应用程序的源代码打包成存档
    asar: true,
    productName: "发哥百宝箱",
    directories: {
      output: "dist/" + platform + "-" + arch + "-${version}" // 按操作系统拆分输出目录
    },
    // directories: 'release',
    files: ["out/**/*"],
    // extraResources: [
    //   {
    //     "from": (() => {
    //       // win32/x64 、darwin/x64、darwin/arm64、linux/x64
    //       return `resources/${platform}/${arch}/`;
    //     })(),
    //     "to": (() => {
    //       return `./${platform}/${arch}/`;
    //     })()
    //   }
    // ],
    mac: {
      // icon: "public/logo_512.png",
      // target: ["dmg"],
      identity: null,
      artifactName: "${productName}-" + platform + "-" + arch + "-${version}-setup.${ext}"
    },
    win: {
      // icon: "public/logo_256.png",
      target: [
        {
          target: "nsis",
          arch: ["x64"]
        }
      ],
      artifactName: "${productName}-" + platform + "-" + arch + "-${version}-setup.${ext}"
    },
    // 安装过程的配置
    nsis: {
      // 是否一键安装
      oneClick: false,
      perMachine: false,
      // 允许修改安装目录
      allowToChangeInstallationDirectory: true,
      createDesktopShortcut: true, // 创建桌面图标
      // 控制在卸载时是否删除应用的数据文件夹
      deleteAppDataOnUninstall: true,
      createStartMenuShortcut: true, // 创建开始菜单图标
      uninstallDisplayName: "卸载财到嘉"
    },
    publish: {
      provider: "generic",
      url: "http://www.aicdj.top/app-release/"
    }
  };
}
